<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }
        .search-container {
            width: 80%;
            max-width: 400px;
            text-align: center;
        }
        .search-input {
            width: 70%;
            padding: 10px;
            font-size: 16px;
            border: 1px solid #ccc;
            border-radius: 5px;
            box-sizing: border-box;
            display: inline-block;
        }
        .search-button {
            width: 25%;
            padding: 10px 20px;
            font-size: 16px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            display: inline-block;
        }
    </style>
     <script>
        document.addEventListener('DOMContentLoaded', function() {
            var form = document.querySelector('.search-container form');
            form.addEventListener('submit', function(event) {
                event.preventDefault();
                var query = form.querySelector('.search-input').value;
                var xhr = new XMLHttpRequest();
                xhr.open('POST', 'http://127.0.0.1:2024/search');
                xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                xhr.onload = function() {
                    if (xhr.status === 200) {
                        var responseText = xhr.responseText;
                        var searchInput = form.querySelector('.search-input');
                        var resultDisplay = document.createElement('div');
                        resultDisplay.textContent = responseText;
                        form.appendChild(resultDisplay);
                    } else {
                        console.error('Request failed. Status: ' + xhr.status);
                    }
                };
                xhr.send('query=' + query);
            });
        });
    </script>
</head>
<body>
    <div class="search-container">
        <form action="/search" method="get">
            <input type="text" class="search-input" name="query" placeholder="Enter your search term">
            <button type="submit" class="search-button">Search</button>
        </form>
    </div>
</body>
</html>